Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@babel/plugin-syntax-import-assertions
Advanced tools
Allow parsing of the module assertion attributes in the import statement
The @babel/plugin-syntax-import-assertions package allows Babel to parse the import assertions syntax, which is a feature that enables developers to make assertions about the kind of content they are importing. This is particularly useful for ensuring that modules being imported are of the expected type, such as JSON, HTML, or other non-JavaScript resources.
Parsing import assertions
This feature allows Babel to understand and parse the import assertions syntax, which is used to assert the type of file being imported. In this code sample, an assertion is made that the imported module 'data.json' is of type 'json'.
import json from './data.json' assert { type: 'json' };
This package allows Babel to transform JSON string literals into actual JSON objects. It is similar to @babel/plugin-syntax-import-assertions in that it deals with JSON within the context of JavaScript modules, but it focuses on the transformation of JSON strings rather than the import assertions syntax.
Allow parsing of the module assertion attributes in the import statement
See our website @babel/plugin-syntax-import-assertions for more information.
Using npm:
npm install --save-dev @babel/plugin-syntax-import-assertions
or using yarn:
yarn add @babel/plugin-syntax-import-assertions --dev
v7.25.7 (2024-10-02)
babel-helper-validator-identifier
babel-traverse
babel-plugin-transform-classes
super()
check (@nicolo-ribaudo)babel-generator
infer
in compact mode (@nicolo-ribaudo)[no LineTerminator here]
after nodes (@nicolo-ribaudo)babel-types
babel-core
--experimental-require-module
(@nicolo-ribaudo)babel-helper-compilation-targets
, babel-helper-plugin-utils
, babel-preset-env
babel-plugin-proposal-destructuring-private
, babel-plugin-syntax-decimal
, babel-plugin-syntax-import-reflection
, babel-standalone
babel-generator
[no LineTerminator here]
before nodes (@nicolo-ribaudo)babel-plugin-transform-typescript
babel-types
BABEL_TYPES_8_BREAKING
at startup (@nicolo-ribaudo)FAQs
Allow parsing of the module assertion attributes in the import statement
The npm package @babel/plugin-syntax-import-assertions receives a total of 12,505,503 weekly downloads. As such, @babel/plugin-syntax-import-assertions popularity was classified as popular.
We found that @babel/plugin-syntax-import-assertions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.